import request from '@/utils/request'

// 查询默认查询视图列表
export function getByUser(sqlcode, paramsMap) {
  var data = {}
  data.sqlCode = sqlcode
  data.paramsMap = paramsMap
  return request({
    url: '/view/searchMainView/getByUser/',
    method: 'post',
    data: data
  })
}

// 查询默认查询视图列表
export function getDataListByView(queryData) {
  return request({
    url: '/view/searchMainView/getDataListByView/',
    method: 'post',
    data: queryData
  })
}

// 获取合计行
export function getDealSum(queryData) {
  return request({
    url: '/view/searchMainView/getDealSum',
    method: 'post',
    data: queryData
  })
}

// 根据视图ID查询视图详情
export function getInfoById(id) {
  return request({
    url: '/view/searchMainView/' + id,
    method: 'get'
  })
}

// 查询当前用户所属的视图
export function viewList(sqlcode) {
  var queryData = {}
  queryData.sqlBaseId = sqlcode
  return request({
    url: '/view/searchMainView/list/',
    method: 'get',
    params: queryData
  })
}

// 修改视图选中状态
export function updateSelectStatus(viewId, isSelect) {
  var mainView = {}
  mainView.id = viewId
  mainView.isSelect = isSelect
  return request({
    url: '/view/searchMainView/updateSelectStatus/',
    method: 'get',
    params: mainView
  })
}

// 给view视图排序
export function viewSort(searchMainViewList) {
  var data = {}
  data.searchMainViewList = searchMainViewList
  return request({
    url: '/view/searchMainView/viewSort',
    method: 'post',
    data: data
  })
}

// 保存视图
export function viewSave(searchMainView) {
  return request({
    url: '/view/searchMainView/save',
    method: 'post',
    data: searchMainView
  })
}

// 删除视图
export function delMainView(id) {
  return request({
    url: '/view/searchMainView/' + id,
    method: 'delete'
  })
}
